import type { App } from 'vue'
//导入我们的element-plus的css文件
import 'element-plus/dist/index.css'

//导入需要使用到的组件
import {
  ElRow,
  ElCol,
  ElButton,
  ElCheckbox,
  ElForm,
  ElFormItem,
  ElInput,
  ElLink,
  ElRadio,
  ElTabPane,
  ElTabs,
  ElConfigProvider,
  ElBreadcrumb,
  ElBreadcrumbItem,
  ElSelect,
  ElOption,
  ElDatePicker,
  ElTimePicker,
  ElPopover,
  ElTooltip,
  ElMessageBox,
  ElMessage,
  ElNotification,
  ElUpload,
  ElTable,
  ElTableColumn,
  ElPagination,
  ElDialog,
  ElDropdown,
  ElDropdownMenu,
  ElDropdownItem,
  ElMenu,
  ElSubMenu,
  ElMenuItem,
  ElMenuItemGroup,
  ElInputNumber,
  ElCheckboxGroup,
  ElRadioGroup,
  ElSwitch,
  ElRate,
  ElSlider,
  ElTransfer,
  ElSteps,
  ElStep,
  ElSkeleton,
  ElSkeletonItem,
  ElAvatar,
  ElResult,
  ElAlert,
  ElLoading,
  ElIcon,
  ElCalendar,
  ElTimeSelect,
  ElDescriptions,
  ElDescriptionsItem,
  ElEmpty,
  ElImage,
  ElTree,
  ElCascader,
  ElColorPicker,
  ElScrollbar,
} from 'element-plus'
import { ElCard } from 'element-plus/es'

//将我们要使用到组件名放入到一个数组中
const components = [
  ElRow,
  ElCol,
  ElButton,
  ElRadio,
  ElTabs,
  ElTable,
  ElTableColumn,
  ElPagination,
  ElCard,
  ElTabPane,
  ElCheckbox,
  ElLink,
  ElConfigProvider,
  ElMenu,
  ElSubMenu,
  ElMenuItem,
  ElMenuItemGroup,
  ElIcon,
  ElScrollbar,
  ElBreadcrumb,
  ElBreadcrumbItem,
  ElDropdown,
  ElDropdownMenu,
  ElDropdownItem,
  ElPopover,
  ElDialog,
  ElForm,
  ElFormItem,
  ElInput,
  ElSelect,
  ElOption,
  ElMessage,
  ElUpload,
]

//暴露Element-Plus全局注册方法
export default function (app: App): void {
  //循环components数组进行全局注册
  for (const component of components) {
    app.component(component.name, component)
  }
}
